function resove_data(data){
    var re = [];
    for(var k in data) {
        var str = k +'=' + data[k];
        re.push(str);
    }
    var s = re.join('&');
    return re;
}
function myajax(options){
    var xhr = new XMLHttpRequest();
    var data_str = resove_data(options.data);
    if (options.method.toUpperCase() === 'GET') {
        xhr.open(options.method,options.url + '?' + data_str);
        xhr.send();
    }else if (options.method.toUpperCase() === 'post') {
        xhr.open(options.method,options.url);
        xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        xhr.send(data_str);
    }
    xhr.onreadystatechange = function(){
        if (xhr.readyState === 4 && xhr.status === 200) {
            options.success(JSON.parse(xhr.responseText));
        }
    }
}